import { type App } from 'vue'
import SvgIcon from '@/components/SvgIcon/index.vue' // svg component

// register globally
export default (app: App): void => {
  app.component('svg-icon', SvgIcon)
}

const modules = import.meta.glob('./svg/*.svg')
const requireAll = (modules: Record<string, () => Promise<unknown>>) => {
  Object.keys(modules).forEach((key) => {
    const module = modules[key]
    if (typeof module === 'function') {
      module()
    }
  })
}
requireAll(modules)
